package com.mf.all.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import com.mf.all.entity.dto.DtoSet;
import com.mf.all.entity.req.search.basic.SearchReqSet;
import com.mf.all.mapper.MapperSet;
import com.mf.all.service.ServiceSet;


    


@Service
public class ImplServiceSet extends ServiceImpl<MapperSet, DtoSet> implements ServiceSet {


    @Override
    public LambdaQueryWrapper<DtoSet> fillParams(SearchReqSet params) {
        final LambdaQueryWrapper<DtoSet> wrapper = loadQw();
        if(StringUtils.isNotBlank(params.getKey())){
            wrapper.and(w -> {
                w.like(DtoSet::getSetKey, params.getKey())
                        .or()
                        .like(DtoSet::getSetMark, params.getKey())
                        .or()
                        .like(DtoSet::getRemark, params.getKey())
                        .or()
                        .like(DtoSet::getSetValue, params.getKey());
            });
        }
        return wrapper.orderByDesc(DtoSet::getId);
    }
}